<%@include file="loginCheck.jsp"%>
<%@ page import="com.dao.FlightDaoImpl" %>
<%--
  Created by IntelliJ IDEA.
  User: Phillip
  Date: 2014/5/7
  Time: 16:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String flightnumber1 = request.getParameter("flightnumber1");
    String flightnumber2 = request.getParameter("flightnumber2");
    String deptdate1 = request.getParameter("date1");
    String deptdate2 = request.getParameter("date2");

    FlightDaoImpl flightDao = new FlightDaoImpl();
    ;
%>
<html>
<head>
    <title>Flight Booking Centre</title>
</head>
<body>
<H1 align="center">
    Flight Booking Centre
</H1>

<FORM action="/Book" method="post">
    <TABLE border="1" align="center">
        <TR>
            <TD>
                Flight Number
            </TD>
            <TD>
                Departing Date
            </TD>
            <TD>
                Seat Class
            </TD>
            <TD>
                Price
            </TD>
        </TR>
        <TR>
            <TD>
                <%= flightnumber1%>
            </TD>
            <TD>
                <%= deptdate1%>
            </TD>
            <TD>
                <div><input type="radio" name="class1" value="ECO" CHECKED>ECO</div>
                <div><input type="radio" name="class1" value="BUS">BUS</div>
                <div><input type="radio" name="class1" value="FIR">FIR</div>
            </TD>
            <TD>
                <div><%= flightDao.queryRates(flightnumber1, "ECO", 3)%></div>
                <div><%= flightDao.queryRates(flightnumber1, "BUS", 3)%></div>
                <div><%= flightDao.queryRates(flightnumber1, "FIR", 3)%></div>
            </TD>
        </TR>
        <TR>
            <TD>
                <%= flightnumber2%>
            </TD>
            <TD>
                <%= deptdate2%>
            </TD>
            <TD>
                <div><input type="radio" name="class2" value="ECO" CHECKED>ECO</div>
                <div><input type="radio" name="class2" value="BUS">BUS</div>
                <div><input type="radio" name="class2" value="FIR">FIR</div>
            </TD>
            <TD>
                <div><%= flightDao.queryRates(flightnumber2, "ECO", 3)%></div>
                <div><%= flightDao.queryRates(flightnumber2, "BUS", 3)%></div>
                <div><%= flightDao.queryRates(flightnumber2, "FIR", 3)%></div>
            </TD>
        </TR>
    </TABLE>
    <div align="center">
        <input type="submit" value="SUBMIT"><input type="button" value="BACK" onclick="window.location.href='/Servlet'">
    </div>
</FORM>
</body>
</html>
